#include "../Enemy.h"
#include "../../Games/MyGame.h"

Enemy::Enemy(int maxFrequency, std::string name) : AI(maxFrequency, name)
{
}

Enemy::~Enemy() {
}
void Enemy::act(int action) {
	POINT3D newPosition = {getPosition().x, getPosition().y, getPosition().z};
	switch(action) {
	case LEFT: newPosition.x -= 1;
		break;
	case RIGHT: newPosition.x +=1;
		break;
	case UP: newPosition.y += 1;
		break;
	case DOWN: newPosition.y -= 1;
		break;
	case SHOOT:
		createShot();
	}
	setPosition(newPosition);
}
POINT3D Enemy::simulateMove(POINT3D position, int action) {
	POINT3D newPosition = {position.x, position.y, position.z};
	switch(action) {
	case LEFT: newPosition.x -= 1;
		break;
	case RIGHT: newPosition.x +=1;
		break;
	case UP: newPosition.y += 1;
		break;
	case DOWN: newPosition.y -= 1;
	}
	return newPosition;
}
void Enemy::createShot() {
	MyGame::Instance()->createEntity(this->getMySceneNode(),0,SHIPSHOT,70,"REShot",this->getOrientation(),this->getPosition(),this->getColor());
}